﻿///////////////////////////////////////////////////////////////
// This is generated code. 
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 3.5
// Code is generated on: Monday, December 17, 2012 11:21:26 AM
// Code is generated using templates: SD.TemplateBindings.SharedTemplates.NET20
// Templates vendor: Solutions Design.
// Templates version: 
//////////////////////////////////////////////////////////////
using System;
using System.Collections;
using System.Collections.Generic;
using WHMS;
using WHMS.FactoryClasses;
using WHMS.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;

namespace WHMS.RelationClasses
{
	/// <summary>Implements the relations factory for the entity: Shelf. </summary>
	public partial class ShelfRelations
	{
		/// <summary>CTor</summary>
		public ShelfRelations()
		{
		}

		/// <summary>Gets all relations of the ShelfEntity as a list of IEntityRelation objects.</summary>
		/// <returns>a list of IEntityRelation objects</returns>
		public virtual List<IEntityRelation> GetAllRelations()
		{
			List<IEntityRelation> toReturn = new List<IEntityRelation>();
			toReturn.Add(this.InitialBalanceEntityUsingShelfId);
			toReturn.Add(this.InventoryItemEntityUsingShelfId);
			toReturn.Add(this.StoreShelfBalanceEntityUsingShelfId);
			toReturn.Add(this.TransactionItemEntityUsingShelfId);
			toReturn.Add(this.ShelfTypeEntityUsingTypeId);
			toReturn.Add(this.StoreEntityUsingStoreId);
			return toReturn;
		}

		#region Class Property Declarations

		/// <summary>Returns a new IEntityRelation object, between ShelfEntity and InitialBalanceEntity over the 1:n relation they have, using the relation between the fields:
		/// Shelf.Id - InitialBalance.ShelfId
		/// </summary>
		public virtual IEntityRelation InitialBalanceEntityUsingShelfId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "InitialBalances" , true);
				relation.AddEntityFieldPair(ShelfFields.Id, InitialBalanceFields.ShelfId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ShelfEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("InitialBalanceEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between ShelfEntity and InventoryItemEntity over the 1:n relation they have, using the relation between the fields:
		/// Shelf.Id - InventoryItem.ShelfId
		/// </summary>
		public virtual IEntityRelation InventoryItemEntityUsingShelfId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "InventoryItems" , true);
				relation.AddEntityFieldPair(ShelfFields.Id, InventoryItemFields.ShelfId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ShelfEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("InventoryItemEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between ShelfEntity and StoreShelfBalanceEntity over the 1:n relation they have, using the relation between the fields:
		/// Shelf.Id - StoreShelfBalance.ShelfId
		/// </summary>
		public virtual IEntityRelation StoreShelfBalanceEntityUsingShelfId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "StoreShelfBalances" , true);
				relation.AddEntityFieldPair(ShelfFields.Id, StoreShelfBalanceFields.ShelfId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ShelfEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("StoreShelfBalanceEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between ShelfEntity and TransactionItemEntity over the 1:n relation they have, using the relation between the fields:
		/// Shelf.Id - TransactionItem.ShelfId
		/// </summary>
		public virtual IEntityRelation TransactionItemEntityUsingShelfId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "TransactionItems" , true);
				relation.AddEntityFieldPair(ShelfFields.Id, TransactionItemFields.ShelfId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ShelfEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TransactionItemEntity", false);
				return relation;
			}
		}


		/// <summary>Returns a new IEntityRelation object, between ShelfEntity and ShelfTypeEntity over the m:1 relation they have, using the relation between the fields:
		/// Shelf.TypeId - ShelfType.Id
		/// </summary>
		public virtual IEntityRelation ShelfTypeEntityUsingTypeId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne, "ShelfType", false);
				relation.AddEntityFieldPair(ShelfTypeFields.Id, ShelfFields.TypeId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ShelfTypeEntity", false);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ShelfEntity", true);
				return relation;
			}
		}
		/// <summary>Returns a new IEntityRelation object, between ShelfEntity and StoreEntity over the m:1 relation they have, using the relation between the fields:
		/// Shelf.StoreId - Store.Id
		/// </summary>
		public virtual IEntityRelation StoreEntityUsingStoreId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne, "Store", false);
				relation.AddEntityFieldPair(StoreFields.Id, ShelfFields.StoreId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("StoreEntity", false);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ShelfEntity", true);
				return relation;
			}
		}
		/// <summary>stub, not used in this entity, only for TargetPerEntity entities.</summary>
		public virtual IEntityRelation GetSubTypeRelation(string subTypeEntityName) { return null; }
		/// <summary>stub, not used in this entity, only for TargetPerEntity entities.</summary>
		public virtual IEntityRelation GetSuperTypeRelation() { return null;}
		#endregion

		#region Included Code

		#endregion
	}
	
	/// <summary>Static class which is used for providing relationship instances which are re-used internally for syncing</summary>
	internal static class StaticShelfRelations
	{
		internal static readonly IEntityRelation InitialBalanceEntityUsingShelfIdStatic = new ShelfRelations().InitialBalanceEntityUsingShelfId;
		internal static readonly IEntityRelation InventoryItemEntityUsingShelfIdStatic = new ShelfRelations().InventoryItemEntityUsingShelfId;
		internal static readonly IEntityRelation StoreShelfBalanceEntityUsingShelfIdStatic = new ShelfRelations().StoreShelfBalanceEntityUsingShelfId;
		internal static readonly IEntityRelation TransactionItemEntityUsingShelfIdStatic = new ShelfRelations().TransactionItemEntityUsingShelfId;
		internal static readonly IEntityRelation ShelfTypeEntityUsingTypeIdStatic = new ShelfRelations().ShelfTypeEntityUsingTypeId;
		internal static readonly IEntityRelation StoreEntityUsingStoreIdStatic = new ShelfRelations().StoreEntityUsingStoreId;

		/// <summary>CTor</summary>
		static StaticShelfRelations()
		{
		}
	}
}
